
import {Request} from '../../../utils/request.js';
var app = getApp();
Page({

  data: {    

    showLogin: false,  //登陆框

    data: {
      lottery: "--",
      join: "--",
      reward: "--",
      score: "--",
    },

    userInfo: {},


  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {  
    let that = this;
 
  },

  /**
 * 生命周期函数--监听页面显示
 */

  onShow: function () {
    this.getData();
  },

  getData: function() {
    let that = this;
   let data = {
      lottery: 3,
      join: 1,
      reward: 0,
      score: 50,
    };
    that.setData({
      data: data
    })
  },



  // 功能条跳转
  goPage: function(e) {
    let page = e.currentTarget.dataset.page;
    let path = '';

    console.log(['cash', 'score', 'info'].indexOf(page));
    if(['cash', 'score', 'info'].indexOf(page) >= 0 && !app.checkLogin()) {
        return ;
    }
    if(page == 'cash') {
      path = '/pages/profile/cash/cash';
    }else if(page == 'score') {
      path = '/pages/profile/score/score';
    }else if(page == 'help') {
      path = '/pages/help/help';
    }else if(page == 'lottery') {
      path = '/pages/activity/lottery/lottery';
    }else {
      wx.showModal({
        title: '提示',
        content: '该功能暂不开源',
      })
      return ;
    }
    wx.navigateTo({
      url: path,
    })

  },



  loginSuccess: function() {
    this.getData();
  },
  loginDialog: function(e) {
    this.setData({
      showLogin: e.detail.flag
    })
  },

  onTemp: function() {
    wx.showToast({
      title: "暂未开通，尽情期待！",
      icon: "none",
      duration: 1500
    })
  },



  onReady: function () {

  },


  

  onShareAppMessage: function () {
    return app.shareAppMessage();
  },





  //我发起的
  onMyTottery: function(e) {
    wx.showModal({
      title: '提示',
      content: '该功能暂不开源',
    })
    return ;
    var type = e.currentTarget.dataset.type;
    wx.navigateTo({
      url: '/pages/profile/lottery/lottery?type='+type,
    })
  },
  

})